import { Component } from 'react'
import { View, Text,Image} from '@tarojs/components'
import { AtIcon,AtAvatar} from 'taro-ui'
import Taro　from '@tarojs/taro';
import "taro-ui/dist/style/components/avatar.scss";
import "taro-ui/dist/style/components/search-bar.scss";
import "taro-ui/dist/style/components/icon.scss";
import "taro-ui/dist/style/components/button.scss" // 按需引入
import './header.less'
import {BASEURL} from "../../constants/global";

export default class Header extends Component {
   constructor(props){
      super(props)
      this.state={
         shi:"",
         hphoto:"https://jdc.jd.com/img/200",
         username:"fdsfdsf"
      }
      this.tomyhang = this.tomyhang.bind(this);
   }

   //跳到个人资料c
    topersonimf(){
       Taro.navigateTo({url:'personimf'})
    }
    //跳到我的挂号
    tomyhang(){
       // Taro.request({
       //   url:'http://localhost:8080/shi',
       // }).then(res=>{
       //   console.log(res.data)
       //   this.shi=res.data
       //   this.setState({
       //      shi:res.data
       //   })
       //   console.log(this.shi)
       //   console.log(this.state.shi)
       // })
       //
       // Taro.request({
       //    url:"http://localhost:8080/shi1?b=ewfew"
       // }).then(res=>{
       //
       // })
      // Taro.request({
      //   url:"http://localhost:8080/shi1?",
      //   data:{
      //     b:this.state.shi
      //   }
      // }).then(res=>{
      //
      // })

      // $(".header").append("<Text>cdvcgdsh</Text>")

       Taro.navigateTo({url:"myhang"})
    }
    //跳到就趁人管理
    tocomam(){
       Taro.navigateTo({url:'ecomam'})
    }
    render () {
      return (
        <View className="header">
           <View className="head" value='chevron-right' color='#FFF'>
              <AtAvatar circle image={this.state.hphoto} className="headat">

              </AtAvatar>
              <text className="headtext">{this.state.username}</text>
              <View className='iconright'>
              <AtIcon value='chevron-right' size='30' color="#fff" onClick={this.topersonimf}></AtIcon>
              </View>
           </View>
           <View className="nexthead">
             <View className="myhang" onClick={this.tomyhang}>
             <Image className='myhandimg' src={`${BASEURL}u1227.svg`} />
                <Text className='myhangtext'>我的挂号</Text>
             </View>
             <View className="mymag" onClick={this.tocomam}>
             <Image className='mymagimg' src={`${BASEURL}u1230.svg`} />
                <Text className='mymagtext'>就诊人管理</Text>
             </View>
           </View>
        </View>
      );
    }
  }



